package com.ruoyi.project.experiment.experimentstudent.service.impl;

import com.ruoyi.project.experiment.experimentstudent.domian.EchartResult;
import com.ruoyi.project.experiment.experimentstudent.domian.StatusOther;
import com.ruoyi.project.experiment.experimentstudent.domian.StudentExperiment;
import com.ruoyi.project.experiment.experimentstudent.mapper.TbExperimentReportMapper;
import com.ruoyi.project.experiment.experimentstudent.service.ITbExperimentReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 实验成绩Service业务层处理
 * 
 * @author lvyongwei
 * @date 2020-09-21
 */
@Service
public class TbExperimentReportServiceImpl implements ITbExperimentReportService
{

    @Autowired
    private TbExperimentReportMapper tbExperimentReportMapper;

    /**
     *
     * @param studentExperiment 实验成绩
     * @return
     */
    @Override
    public int insertTbExperimentReport(StudentExperiment studentExperiment) {
        return tbExperimentReportMapper.insertTbExperimentReport(studentExperiment);
    }

    /**
     *
     * @param studentExperiment 实验成绩
     * @return
     */
    @Override
    public int updateTbExperimentReport(StudentExperiment studentExperiment) {
        return tbExperimentReportMapper.updateTbExperimentReport(studentExperiment);
    }

    /**
     * 查询是否提交在线实验成绩
     * @param studentExperiment
     * @return
     */
    @Override
    public StudentExperiment getReport(StudentExperiment studentExperiment) {
        return tbExperimentReportMapper.getReport(studentExperiment);
    }

    /**
     * 教师获取实验结果
     * @param studentExperiment
     * @return
     */
    @Override
    public List<StudentExperiment> getResults(StudentExperiment studentExperiment) {
        return tbExperimentReportMapper.getResults(studentExperiment);
    }

    /**
     * 获取实验结果
     * @Param reportExperimentId  实验id
     * @Param reportStuId   学生id
     * @return
     */
    @Override
    public List<StudentExperiment> getResultExperiment(StudentExperiment studentExperiment) {
        return tbExperimentReportMapper.getResultExperiment(studentExperiment);
    }

    /**
     * 教师批改实验 评语+分数
     * @param studentExperiment
     * @return
     */
    @Override
    public boolean checkScore(StudentExperiment studentExperiment) {
        return tbExperimentReportMapper.checkScore(studentExperiment);
    }



    /**
     * 学生获取实验结果
     * @param studentExperiment
     *  @return
     */
    @Override
    public List<StudentExperiment> getResults2(StudentExperiment studentExperiment) {
        return tbExperimentReportMapper.getResults2(studentExperiment);
    }






    /**
     * 做图表
     */
    /**
     * 获取实验体验人次
     * @return
     */
    @Override
    public List<StudentExperiment> getStuCount() {
        return tbExperimentReportMapper.getStuCount();
    }
    /**
     * 获取实验体验人次
     * @return
     */
    @Override
    public List<StatusOther> getStuCountOther() {
        return tbExperimentReportMapper.getStuCountOther();
    }

    /**
     * 获取某一个实验的成绩分布
     */
    @Override
    public EchartResult getScore(Long experimentId) {
        return tbExperimentReportMapper.getScore(experimentId);
    }

    /**
     * 获取每个实验最常用时和最短用时，以及最高、低分数
     * @return
     */
    @Override
    public List<EchartResult> getDescribe() {
        return tbExperimentReportMapper.getDescribe();
    }
}
